package com.fouram.swagger.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * @author Liup
 */
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {

	@Bean
	public Docket platformApi() {
		return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).forCodeGeneration(true).select()
				.apis(RequestHandlerSelectors.basePackage("com.fouram")).paths(PathSelectors.any()).build();
	}

	private ApiInfo apiInfo() {
		return new ApiInfoBuilder().title("fouram-api").description("©2024 Copyright.").build();
	}

	/**
	 @Configuration
	 public class WebMvcConfig extends WebMvcConfigurationSupport {
		 @Override
		 public void addResourceHandlers(ResourceHandlerRegistry registry) {
			 registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
			 registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
			 registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
			 registry.addResourceHandler("/public/**").addResourceLocations("/public/");
		 }
	 }
	 */
}
